table.RANGE_DROP Function

Syntax

V Range_Drop()

Description

Drop the current range from the table.

Discussion

The <TBL>.RANGE_DROP() method removes the active range for the table referenced by the object pointer, <TBL>, replacing it with the previous range that was applied to the table. If a range is not dropped, it is maintained in a stack of ranges that grows as New ranges are added. If you try to drop a range and there are no more ranges on the stack, an error is generated that you can trap with an ON ERROR GOTO command.

Example

This script sets the current range to include only customer records that are in the mailing list. All the records in the range have their Mailing_sent field set to Y. The range is then removed to display the records that were previously displayed.

tbl = table.current()
idx = tbl.index_primary_get()
range.flags = RANGE_INDEX .or. RANGE_FILTER
range.index_pointer = idx
range.filter = "MAILLIST = .T."
tbl.range_add()
tbl.fetch_first()
while .NOT. tbl.fetch_eof()
    tbl.change_begin()
    tbl.mailing_sent = "Y"
    tbl.change_end(.T.)
    tbl.fetch_next()
end while
tbl.range_drop()

See Also